// 类(Classes) readonly 只读属性 声明后不可修改

export {}

class Person {
    // ES2017中新增
    public name: string// = 'init name' 公有成员 默认 建议加 都可以访问 
    private age: number// = 11  私有属性 只能类的内部访问 不能在外部和子类中访问
    protected readonly  gender: boolean //受保护的 只能在子类中访问



    constructor(name: string, age: number) {
        this.name = name
        this.age = age 
        this.gender = true
    }

    sayHi(msg: string): void {
        console.log(`I am ${this.name}, ${msg}`)
    }
}

const tom = new Person('tom', 18)
console.log(tom.name)




